#ifndef __PARSER_H__
#define __PARSER_H__

#include "Lexer.h"
#include "NodeVisitor.h"

class Parser {

	struct State {
		std::map<std::string, unsigned int> transitions;
		std::map<std::string, unsigned int> reductions;
	};
	struct Rule {
		std::string lefthand;
		unsigned int righthandSize;
	};

	SP<ParseNode> _root;
	bool _isAValidProgram;
public:
	Parser(const char *parsetablefilename, const char *programfilename, const char *dfaFilename);

	const bool IsAValidProgram() const { return _isAValidProgram; }
	ParseNode* Root() { return _root(); }

};

class ParseTableFileNotFound : public std::exception {
	virtual const char* what() const throw() {
		return "The given parse table file failed to open";
	}
};
#endif